import request from '@/utils/request'
//设置-角色模块接口
// 初始化请求角色列表接口  查询角色
export const listRole = (search) => 
    request({
        url: '/sys/role/get_role_list',
        method: 'get',
        params: {
            pageSize: search.limit,
            keyWord: search.name,
            pageNo:search.currentPage
        }        
    })

export const getRoleById = (id) =>
    request({
        url: '/sys/role/get_role?code=' + id,
        method: 'get'
    })


export const removeRole = (id) =>
    request({
        url: '/sys/role/delete_role',
        method: 'get',
        params:{
            code:id 
        }         
    })  

export const  listTree = () =>
    request({
        url:'/sys/menu/get_menu_list?pageNo=1&pageSize=1000',
        method:'get'
    })
    

export const saveRole = (role) => 
    request({
        url: '/sys/role/create_role',
        method: 'post',
        data: JSON.stringify(role)
    })


//编辑 code！！！！！
export const modifyRole = (form) => 
    request({
        url: '/sys/role/modify_role',
        method: 'post',
        data: JSON.stringify(form)     
})